<?php echo Modules::run('content/header_content') ?>
 
<div class="container main">
	<div>
      
      
		<div class="15">
			<div class="row">
				<div class="span15 content">
  						<h1>Order Information</h1>  
          		</div>
        	</div>
        	<div class="row">
        		<?php $user_id = Modules::run('auth/get_user_id');
		
			  		$cus = $this->order_model->get_customer_by_user($user_id); ?>
                    <?php $currency = $this->currency->getCurrency();?>
          
          		<div class="span15 content">
            		<div class="row box-product-row box">
              			<div class="just list" id="orderHistoryInfo">
                            <table class="table table-bordered">
                            	<thead> 
                                	<tr>
                                    	<td>Order ID</td>
                                        <td>Shipping</td>
                                        <td>Image </td>
                                    	<td>Product Name </td>
                                        <td>Quantity </td>
                                        <td>Unit Price </td>
                                        <td>Total </td>
                                    </tr>
                                </thead>
                                    <?php foreach($order_product as $product){ ?>
                                	<tr>
                                    	<td class="right"><?php echo $product->order_id ?></td>
                                        <?php $shipping = $this->account_model->get_shipping_by_product($product->product_id) ?>
										<?php if($shipping->shipping_method == '0'){ ?>
                                        <td>-- : <?php echo $this->currency->format($shipping->price, $currency); ?></td>
                                        <?php }else{ ?>
                                            <td><?php echo $shipping->shipping_method; ?> : <?php echo $this->currency->format($shipping->price, $currency); ?></td>
                                        <?php } ?>
                                        <?php $products = $this->account_model->get_product($product->product_id); ?>
                                        <?php foreach($products as $pro){ ?>
                                        <td><img style="width:48px;height:48px;" src="<?php echo base_url('data/thumb/'.$pro->image_file) ?>"></td>
                                        <?php } ?>
                                    	<td><?php echo $product->name; ?></td>
                                        <td class="right"><?php echo $product->quantity; ?></td>
										<td class="right"><?php echo $this->currency->format($product->price, $currency); ?></td>
										<td class="right"><?php echo $this->currency->format($product->subtotal, $currency); ?></td>
                                    </tr>
                                    <?php } ?>
                                    <tr>
                                    	<td colspan="6" class="right">Sub-Total</td>
                                        <?php $sub_total = $this->account_model->sub_total_order_by_id($order->order_id); ?>
                                        <?php foreach($sub_total as $sub){ ?>
                                        	<td class="right"><?php echo $this->currency->format($s = $sub->subtotal, $currency); ?></td>
                                        <?php } ?>
                                    </tr>
                                    
                                    <?php $total_code_s = $this->account_model->order_total_by_id_code($order->order_id, $ort->code = 'total_shipping') ?>
                                   	<tr>
                                    	<td colspan="6" class="right">Total Shipping</td>
                                        <td class="right">
                                        	<?php echo $this->currency->format($h = $total_code_s->value, $currency); ?>
                                        </td>
                                    </tr>
                                    <?php $total_code_x = $this->account_model->order_total_by_id_code($order->order_id, $ort->code = 'tax') ?>
                                    <tr>
                                    	<td colspan="6" class="right">Total Tax</td>
                                        <td class="right">
                                        	<?php echo $this->currency->format($x = $total_code_x->value, $currency); ?>
                                        </td>
                                    </tr>
                                    <?php $total_code_x = $this->account_model->order_total_by_id_code($order->order_id, $ort->code = 'total') ?>
                                    <tr>
                                    	<td colspan="6" class="right">Total</td>
                                        <td class="right">
                                        	<?php echo $this->currency->format($x = $total_code_x->value, $currency); ?>
                                        </td>
                                    </tr>
                            </table>
                            
                            <h3>Order History</h3>
                            <table class="table table-bordered">
                            	<thead> 
                                	<tr>
                                    	<th>Date Added</th>
										<th>Order Status</th>
                                		<th>Payment Status</th>
										<th>Comment</th>
                                    </tr>
                                </thead>
                                    <?php foreach($order_history as $status){ ?>
                                	<tr>
                                    	<td><?php echo $status->date_added; ?></td>
                                        <?php $get_status = $this->order_model->get_order_status(); ?>
										<?php foreach($get_status as $status_ord){ ?> 
                                            <?php if($status_ord->order_status_id == $status->order_status_id){ ?>
                                                <td><?php echo $status_ord->name ?></td> 
                                            <?php } ?>
                                        <?php } ?>
                                        <?php $get_pay = $this->order_model->get_payment_status(); ?>
                                        <?php foreach($get_pay as $status_pay){ ?> 
                                            <?php if($status_pay->payment_status_id == $status->payment_status_id){ ?>
                                                <td><?php echo $status_pay->name ?></td> 
                                            <?php } ?>
                                        <?php } ?>
                                        <?php if($status->comment == NULL || empty($status->comment)) {?>
                                            <td><?php echo '-----' ?></td>
                                        <?php }else{?>
                                            <td><?php echo $status->comment ?></td>
                                        <?php } ?>
                                    </tr>
                                    <?php } ?>
                            </table>
                            <div id="order-back">
								<a href="<?php echo site_url('account/order_info/'.$order->order_cid); ?>" class="btn" id="cancel" type="button" name="back" value="Back">Back</a> 
       					 	</div>
              			</div>
			  
              			<div class="clearfix">
           				</div>
          			</div>
        		</div>
      		</div>
    	</div>
  	</div>
</div>



<?php echo Modules::run('content/footer_content') ?>